home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / term / term_47a_pch.lha / Source / gtlayout-38.3 / LT_SetAttributes.c < prev    next >
C/C++ Source or Header  |  1996-11-12  |  31KB  |  1,434 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. VOID
  15. LT_SetAttributes(LayoutHandle *handle,LONG id,...)
  16. {
  17.     va_list VarArgs;
  18.  
  19.     va_start(VarArgs,id);
  20.     LT_SetAttributesA(handle,id,(struct TagItem *)VarArgs);
  21.     va_end(VarArgs);
  22. }
  23.  
  24.  
  25. /*****************************************************************************/
  26.  
  27.  
  28. VOID
  29. LTP_AddAllAndRefreshThisGadget(LayoutHandle *Handle,struct Gadget *Gadget)
  30. {
  31.     AddGList(Handle->Window,Handle->List,(UWORD)-1,(UWORD)-1,NULL);
  32.     RefreshGList(Gadget,Handle->Window,NULL,1);
  33. }
  34.  
  35. VOID
  36. LTP_FixState(LayoutHandle *Handle,BOOL State,struct Gadget *Gadget,UWORD Bit)
  37. {
  38.     if(Gadget)
  39.     {
  40.         LTP_StripGadgets(Handle,Handle->List);
  41.  
  42.         if(State)
  43.             Gadget->Flags |=  Bit;
  44.         else
  45.             Gadget->Flags &= ~Bit;
  46.  
  47.         LTP_AddAllAndRefreshThisGadget(Handle,Gadget);
  48.     }
  49. }
  50.  
  51. BOOL
  52. LTP_NotifyPager(LayoutHandle *Handle,LONG ID,LONG Page)
  53. {
  54.     if(ID != -1)
  55.     {
  56.         LT_SetAttributes(Handle,ID,
  57.             LAGR_ActivePage,Page,
  58.         TAG_DONE);
  59.  
  60.         if(Handle->Failed)
  61.             return(FALSE);
  62.     }
  63.  
  64.     return(TRUE);
  65. }
  66.  
  67.  
  68. /*****************************************************************************/
  69.  
  70.  
  71. /****** gtlayout.library/LT_SetAttributesA ******************************************
  72. *
  73. *   NAME
  74. *    LT_SetAttributesA -- Change object attributes
  75. *
  76. *   SYNOPSIS
  77. *    LT_SetAttributesA(Handle,ID,Tags);
  78. *                        A0   D0  A1
  79. *
  80. *    VOID LT_SetAttributes(LayoutHandle *,LONG,struct TagItem *);
  81. *
  82. *    LT_SetAttributes(Handle,ID,...);
  83. *
  84. *    VOID LT_SetAttributes(LayoutHandle *,LONG,...);
  85. *
  86. *   FUNCTION
  87. *    This routine passes the tag item list it gets directly
  88. *    over to GT_SetGadgetAttrsA(), so any tag items valid for
  89. *    gadtools.library can be used here as well. Some filtering
  90. *    may be done in order to stop objects from getting redrawn
  91. *    if this is not absolutely necessary.
  92. *
  93. *   INPUTS
  94. *    Handle - Pointer to LayoutHandle.
  95. *
  96. *    ID - ID number of the object to change. This is the same value
  97. *        you passed via LA_ID to LT_New() when you created this object.
  98. *
  99. *    Tags - Attributes controlling object states.
  100. *
  101. *
  102. *    All gadtools.library tags are allowed, but not all are supported.
  103. *    In addition to these tags a few additional tag values are
  104. *    supported:
  105. *
  106. *    LAHN_AutoActivate (BOOL) - Set to TRUE if you want the interface
  107. *        to always keep a string gadget active if possible. Hitting
  108. *        the return key will then cause the next following string
  109. *        gadget to get activated, either cycling through all the
  110. *        string gadgets available or stopping at the next string
  111. *        gadget to have the LAST_LastGadget attribute set.
  112. *
  113. *    LAHN_UserData (APTR) - Store user specific data in the
  114. *        LayoutHandle->UserData entry. (V9)
  115. *
  116. *    LAHN_RawKeyFilter (BOOL) - Discard unprocessed IDCMP_RAWKEY
  117. *        events. (V13)
  118. *        Default: TRUE
  119. *
  120. *    LAHN_LocaleHook (struct Hook *) - The hook to call when
  121. *        locale string IDs are to be mapped to strings. The
  122. *        hook function is called with the following parameters:
  123. *
  124. *        String = HookFunc(struct Hook *Hook,struct LayoutHandle *Handle,
  125. *          D0                            A0                         A2
  126. *                          LONG ID)
  127. *                               A1
  128. *
  129. *        The function is to look up the string associated with the ID
  130. *        passed in and return the string.
  131. *
  132. *    LAHN_ExitFlush (BOOL) - When the LayoutHandle is finally disposed
  133. *        of with LT_DeleteHandle() all variables maintained by the
  134. *        input handling code will be flushed. For example, if you
  135. *        would use the LA_STRPTR tag for STRING_KIND objects the
  136. *        last string gadget contents would be copied into the buffer
  137. *        pointed to by LA_STRPTR. If you do not want to use this
  138. *        feature, disable it with "LAHN_ExitFlush,FALSE". (V9)
  139. *        Default: TRUE
  140. *
  141. *    GAUGE_KIND:
  142. *
  143. *        LAGA_Percent (LONG) - Percentage of the gauge to fill.
  144. *
  145. *        LAGA_InfoText (STRPTR) - Text to be printed within the
  146. *            gauge display, such as a percentage number.
  147. *
  148. *    BOX_KIND:
  149. *
  150. *        LABX_Index (LONG) - The number of the line to change, this
  151. *            tag works in conjunction with the LABX_Text tag.
  152. *
  153. *        LABX_Text (STRPTR) - The text to put into the line indicated
  154. *            by the LABX_Index tag.
  155. *            As of v26 the LABX_Index tag may be omitted, the library
  156. *            will then assume the line index will be 0.
  157. *
  158. *        LABX_Lines (STRPTR *) - The text to set for the box contents,
  159. *            terminate the text array with NULL.
  160. *
  161. *    HORIZONTAL_KIND:
  162. *    VERTICAL_KIND:
  163. *
  164. *        LAGR_ActivePage (LONG) - Index number of page to display
  165. *            within the group.
  166. *
  167. *                NOTE: requires that this group was created
  168. *                    with the LAGR_ActivePage attribute set.
  169. *
  170. *    INTEGER_KIND:
  171. *
  172. *        LAIN_Min (LONG) - Minimum allowed value for this
  173. *            object.
  174. *
  175. *        LAIN_Max (LONG) - Maximum allowed value for this
  176. *            object.
  177. *
  178. *    LISTVIEW_KIND:
  179. *
  180. *        LALV_Selected (LONG) - Combines GTLV_Selected and
  181. *            GTLV_Top (for Kickstart V37) or GTLV_MakeVisible
  182. *            (for Kickstart V39 and greater). This means, the
  183. *            list display will be changed in order to show
  184. *            the item to be selected. (V34)
  185. *
  186. *    PASSWORD_KIND:
  187. *
  188. *        LAPW_String (STRPTR) - Secret text to use
  189. *
  190. *    POPUP_KIND
  191. *
  192. *        LAPU_Labels (STRPTR *) - To block access to the popup
  193. *            menu, for example before you free the current list
  194. *            of labels, you can pass ~0 as the list parameter. (V25)
  195. *
  196. *    STRING_KIND:
  197. *
  198. *        LAST_CursorPosition (LONG) - Repositions the cursor,
  199. *            pass -1 to move it to the end of the string. (V7)
  200. *
  201. *    TAPEDECK_KIND:
  202. *
  203. *        LATD_Pressed (BOOL) - TRUE to make this button shown
  204. *            as pressed, FALSE to show it in depressed state.
  205. *
  206. *    BOOPSI_KIND:
  207. *
  208. *        All tags are passed straight through to SetGadgetAttrs(..).
  209. *
  210. *    All objects:
  211. *
  212. *        LA_LabelText (STRPTR) - New gadget label text to use.
  213. *
  214. *        LA_LabelID (LONG) - Locale text ID to use for this object.
  215. *
  216. *   RESULT
  217. *    none
  218. *
  219. *   SEE ALSO
  220. *    gadtools.library/GT_SetGadgetAttrsA()
  221. *    intuition.library/SetGadgetAttrsA
  222. *
  223. ******************************************************************************
  224. *
  225. */
  226.  
  227. VOID LIBENT
  228. LT_SetAttributesA(REG(a0) LayoutHandle *handle,REG(d0) LONG id,REG(a1) struct TagItem *TagList)
  229. {
  230.     if(handle && TagList)
  231.     {
  232.         struct Gadget    *Gadget = NULL;
  233.         struct TagItem    *ThisTag,*ThisList = TagList;
  234.         ObjectNode        *Node = NULL;
  235.  
  236.         while(ThisTag = NextTagItem(&ThisList))
  237.         {
  238.             switch(ThisTag->ti_Tag)
  239.             {
  240.                 case LH_AutoActivate:
  241.  
  242.                     handle->AutoActivate = ThisTag->ti_Data;
  243.                     break;
  244.  
  245.                 case LH_RawKeyFilter:
  246.  
  247.                     handle->RawKeyFilter = ThisTag->ti_Data;
  248.                     break;
  249.  
  250.                 case LH_UserData:
  251.  
  252.                     handle->UserData = (APTR)ThisTag->ti_Data;
  253.                     break;
  254.  
  255.                 case LH_ExitFlush:
  256.  
  257.                     handle->ExitFlush = ThisTag->ti_Data;
  258.                     break;
  259.  
  260.                 case LH_LocaleHook:
  261.  
  262.                     handle->LocaleHook = (struct Hook *)ThisTag->ti_Data;
  263.                     break;
  264.  
  265.                 case LAPR_Gadget:
  266.  
  267.                     Gadget = (struct Gadget *)ThisTag->ti_Data;
  268.                     break;
  269.  
  270.                 case LAPR_Object:
  271.  
  272.                     Node = (ObjectNode *)ThisTag->ti_Data;
  273.                     break;
  274.             }
  275.         }
  276.  
  277.         if(Node)
  278.             Gadget = Node->Host;
  279.         else
  280.         {
  281.             if(Gadget)
  282.             {
  283.                 if(Node = (ObjectNode *)Gadget->UserData)
  284.                 {
  285.                     if(Node->Host != Gadget || Node->PointBack != Node)
  286.                         Node = NULL;
  287.                 }
  288.             }
  289.         }
  290.  
  291.         if(!Gadget)
  292.         {
  293.             if(Gadget = LTP_FindGadget(handle,id))
  294.             {
  295.                 if(Node = (ObjectNode *)Gadget->UserData)
  296.                 {
  297.                     if(Node->Host != Gadget || Node->PointBack != Node)
  298.                         Node = NULL;
  299.                 }
  300.             }
  301.             else
  302.                 Node = LTP_FindNode(handle,id);
  303.         }
  304.  
  305.         if(Node)
  306.         {
  307.             STATIC Tag Filter[] = { GA_Disabled,TAG_DONE };
  308.  
  309.             struct TagItem    *NewTags = NULL;
  310.             ULONG             Exclude = NULL;
  311.  
  312.             switch(Node->Type)
  313.             {
  314. #ifdef DO_PASSWORD_KIND
  315.                 case PASSWORD_KIND:
  316.  
  317.                     if(ThisTag = FindTagItem(GTST_String,TagList))
  318.                     {
  319.                         STRPTR String;
  320.                         LONG Len;
  321.  
  322.                         String = (STRPTR)TagList->ti_Data;
  323.  
  324.                         if(String)
  325.                             Len = strlen(String);
  326.                         else
  327.                         {
  328.                             String = "";
  329.                             Len = 0;
  330.                         }
  331.  
  332.                         Exclude = GTST_String;
  333.  
  334.                         strcpy(Node->Special.String.RealString,String);
  335.  
  336.                         if(Len)
  337.                         {
  338.                             memset(Node->Special.String.Original,'·',Len);
  339.                             Node->Special.String.Original[Len] = 0;
  340.                         }
  341.  
  342.                         GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  343.                             GTST_String,Node->Special.String.Original,
  344.                         TAG_DONE);
  345.                     }
  346.  
  347.                     break;
  348. #endif
  349. #ifdef DO_BOOPSI_KIND
  350.                 case BOOPSI_KIND:
  351.  
  352.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  353.                         Node->Disabled = ThisTag->ti_Data;
  354.  
  355.                     if(Node->Special.BOOPSI.TagCurrent)
  356.                     {
  357.                         if(ThisTag = FindTagItem(Node->Special.BOOPSI.TagCurrent,TagList))
  358.                             Node->Current = ThisTag->ti_Data;
  359.                     }
  360.  
  361.                     if(Node->Host)
  362.                         SetGadgetAttrsA(Node->Host,handle->Window,NULL,TagList);
  363.  
  364.                     return;
  365. #endif    /* DO_BOOPSI_KIND */
  366.                 case STRING_KIND:
  367.                 case FRACTION_KIND:
  368.  
  369.                     if(ThisTag = FindTagItem(GTST_String,TagList))
  370.                     {
  371.                         Exclude = GTST_String;
  372.  
  373.                         if(Gadget)
  374.                         {
  375.                             STRPTR String;
  376.  
  377.                             String = (STRPTR)ThisTag->ti_Data;
  378.  
  379.                             if(Node->Type == FRACTION_KIND)
  380.                             {
  381.                                 LTP_CopyFraction(Node->Special.String.RealString,String);
  382.                                 String = Node->Special.String.RealString;
  383.                             }
  384.  
  385.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  386.                                 GTST_String,String,
  387.                             TAG_DONE);
  388.                         }
  389.                         else
  390.                         {
  391.                             if(!Node->Special.String.Backup)
  392.                                 Node->Special.String.Backup = (STRPTR)LTP_Alloc(handle,Node->Special.String.MaxChars + 1);
  393.  
  394.                             if(Node->Special.String.Backup)
  395.                             {
  396.                                 if(ThisTag->ti_Data)
  397.                                     strcpy(Node->Special.String.Backup,(STRPTR)ThisTag->ti_Data);
  398.                                 else
  399.                                     Node->Special.String.Backup[0] = 0;
  400.  
  401.                                 Node->Special.String.String = Node->Special.String.Backup;
  402.                             }
  403.                         }
  404.                     }
  405.  
  406.                     if(Gadget)
  407.                     {
  408.                         if(ThisTag = FindTagItem(LAST_CursorPosition,TagList))
  409.                         {
  410.                             struct StringInfo    *StringInfo = Gadget->SpecialInfo;
  411.                             LONG                 Position,Len;
  412.  
  413.                             LTP_StripGadgets(handle,handle->List);
  414.  
  415.                             Position = (LONG)ThisTag->ti_Data;
  416.  
  417.                             Len = strlen(StringInfo->Buffer);
  418.  
  419.                             if(Position == -1)
  420.                                 Position = Len;
  421.                             else
  422.                             {
  423.                                 if(Position < 0)
  424.                                     Position = 0;
  425.                                 else
  426.                                 {
  427.                                     if(Position > Len)
  428.                                         Position = Len;
  429.                                 }
  430.                             }
  431.  
  432.                             StringInfo->BufferPos = Position;
  433.  
  434.                             LTP_AddAllAndRefreshThisGadget(handle,Gadget);
  435.                         }
  436.                     }
  437.  
  438.                     break;
  439.  
  440. #ifdef DO_LEVEL_KIND
  441.                 case LEVEL_KIND:
  442.                 {
  443.                     LevelExtra    *Special    = &Node->Special.Level;
  444.                     LONG         Level        = Node->Current,
  445.                                  Min        = Node->Min,
  446.                                  Max        = Node->Max,
  447.                                  Plus        = Special->Plus;
  448.                     BOOL         ChangeIt    = FALSE;
  449.  
  450.                     if(ThisTag = FindTagItem(LAVL_Level,TagList))
  451.                     {
  452.                         if((LONG)ThisTag->ti_Data != Level)
  453.                         {
  454.                             Level = (LONG)ThisTag->ti_Data;
  455.  
  456.                             ChangeIt = TRUE;
  457.                         }
  458.                     }
  459.  
  460.                     if(ThisTag = FindTagItem(LAVL_Min,TagList))
  461.                     {
  462.                         if((LONG)ThisTag->ti_Data != Min)
  463.                         {
  464.                             Plus = Min = (LONG)ThisTag->ti_Data;
  465.  
  466.                             ChangeIt = TRUE;
  467.                         }
  468.                     }
  469.  
  470.                     if(ThisTag = FindTagItem(LAVL_Max,TagList))
  471.                     {
  472.                         if((LONG)ThisTag->ti_Data != Max)
  473.                         {
  474.                             Max = (LONG)ThisTag->ti_Data;
  475.  
  476.                             ChangeIt = TRUE;
  477.                         }
  478.                     }
  479.  
  480.                     if(Max < Min)
  481.                     {
  482.                         Max = Min;
  483.                         ChangeIt = TRUE;
  484.                     }
  485.  
  486.                     if(Level > Max)
  487.                     {
  488.                         Level = Max;
  489.                         ChangeIt = TRUE;
  490.                     }
  491.  
  492.                     if(Level < Min)
  493.                     {
  494.                         Level = Min;
  495.                         ChangeIt = TRUE;
  496.                     }
  497.  
  498.                     if(ChangeIt && Gadget && handle->Window)
  499.                     {
  500.                         Node->Current    = Level;
  501.                         Node->Min        = Min;
  502.                         Node->Max        = Max;
  503.                         Special->Plus    = Plus;
  504.  
  505.                         LTP_PutStorage(Node);
  506.  
  507.                         SetAttrs(Special->LevelImage,
  508.                             LVIA_Current,    Node->Current    - Plus,
  509.                             LVIA_Max,        Node->Max        - Plus,
  510.                         TAG_DONE);
  511.  
  512.                         DrawImageState(&handle->RPort,Special->LevelImage,Gadget->LeftEdge,Gadget->TopEdge,IDS_NORMAL,handle->DrawInfo);
  513.  
  514.                         LTP_LevelGadgetDrawLabel(Gadget,FALSE);
  515.                     }
  516.  
  517.                     break;
  518.                 }
  519. #endif    /* DO_LEVEL_KIND */
  520.                 case CHECKBOX_KIND:
  521.  
  522.                     if(ThisTag = FindTagItem(GTCB_Checked,TagList))
  523.                     {
  524.                         if((Node->Current && ThisTag->ti_Data) || (!Node->Current && !ThisTag->ti_Data))
  525.                             Exclude = GTCB_Checked;
  526.                         else
  527.                         {
  528.                             Node->Current = ThisTag->ti_Data;
  529.  
  530.                             LTP_PutStorage(Node);
  531.                         }
  532.                     }
  533.  
  534.                     break;
  535.  
  536. #ifdef DO_TAPEDECK_KIND
  537.                 case TAPEDECK_KIND:
  538.  
  539.                     if(ThisTag = FindTagItem(LATD_Pressed,TagList))
  540.                     {
  541.                         if(Node->Current != ThisTag->ti_Data && Node->Special.TapeDeck.Toggle)
  542.                         {
  543.                             Node->Current = ThisTag->ti_Data;
  544.  
  545.                             LTP_FixState(handle,Node->Current,Gadget,GFLG_SELECTED);
  546.                         }
  547.                     }
  548.  
  549.                     break;
  550. #endif    /* DO_TAPEDECK_KIND */
  551.  
  552. #ifdef DO_GAUGE_KIND
  553.                 case GAUGE_KIND:
  554.                 {
  555.                     LONG Percent         = (LONG)Node->Current;
  556.                     BOOL NeedRefresh    = FALSE;
  557.                     BOOL FullRefresh    = FALSE;
  558.  
  559.                     if(ThisTag = FindTagItem(LAGA_Percent,TagList))
  560.                     {
  561.                         Percent = (LONG)ThisTag->ti_Data;
  562.  
  563.                         if(Percent < 0)
  564.                             Percent = 0;
  565.                         else
  566.                         {
  567.                             if(Percent > 100)
  568.                                 Percent = 100;
  569.                         }
  570.  
  571.                         if(Percent != (LONG)Node->Current)
  572.                             NeedRefresh = TRUE;
  573.                     }
  574.  
  575.                     if(ThisTag = FindTagItem(LAGA_InfoText,TagList))
  576.                     {
  577.                         STRPTR SomeText = (STRPTR)ThisTag->ti_Data;
  578.  
  579.                         if(Node->Special.Gauge.InfoLength)
  580.                         {
  581.                             LONG Len = strlen(SomeText);
  582.  
  583.                             if(Len > Node->Special.Gauge.InfoLength)
  584.                                 Len = Node->Special.Gauge.InfoLength;
  585.  
  586.                             CopyMem(SomeText,Node->Special.Gauge.InfoText,Len);
  587.  
  588.                             Node->Special.Gauge.InfoText[Len] = 0;
  589.  
  590.                             NeedRefresh = TRUE;
  591.                         }
  592.                     }
  593.  
  594.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  595.                     {
  596.                         if(Node->Disabled != ThisTag->ti_Data)
  597.                         {
  598.                             FullRefresh = Node->Disabled;
  599.                             NeedRefresh = TRUE;
  600.  
  601.                             Node->Disabled = ThisTag->ti_Data;
  602.                         }
  603.                     }
  604.  
  605.                     if(NeedRefresh && Gadget)
  606.                         LTP_DrawGauge(handle,Node,Percent,FullRefresh);
  607.                 }
  608.  
  609.                 return;
  610. #endif
  611.                 case LISTVIEW_KIND:
  612.  
  613.                     if(ThisTag = FindTagItem(GTLV_Labels,TagList))
  614.                     {
  615.                         Node->Special.List.Labels = (struct List *)ThisTag->ti_Data;
  616.  
  617.                         if(ThisTag->ti_Data == (ULONG)~0)
  618.                             Node->Min = Node->Max = -1;
  619.                         else
  620.                         {
  621.                             struct List    *List;
  622.                             LONG         Count = 0;
  623.                             struct Node    *Item;
  624.  
  625.                             if(ThisTag->ti_Data)
  626.                                 List = (struct List *)ThisTag->ti_Data;
  627.                             else
  628.                             {
  629.                                 STATIC Tag Filter[] = { GTLV_Labels,TAG_DONE };
  630.  
  631.                                 LONG Current = (LONG)GetTagData(GTLV_Selected,(ULONG)Node->Current,TagList);
  632.  
  633.                                 if(!NewTags)
  634.                                 {
  635.                                     if(!(NewTags = CloneTagItems(TagList)))
  636.                                         return;
  637.                                 }
  638.  
  639.                                 FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  640.  
  641.                                 List = (struct List *)<P_EmptyList;
  642.  
  643.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  644.                                     GTLV_Labels,    List,
  645.                                     GTLV_Selected,    Current,
  646.                                 TAG_DONE);
  647.  
  648.                                 Node->Special.List.Labels = List;
  649.  
  650.                                 DB(kprintf("GTLV_Labels: current = %ld\n",Current));
  651.                             }
  652.  
  653.                             SCANLIST(List,Item)
  654.                             {
  655.                                 Count++;
  656.                             }
  657.  
  658.                             Node->Min = 0;
  659.  
  660.                             if(Count)
  661.                                 Node->Max = Count - 1;
  662.                             else
  663.                                 Node->Max = 0;
  664.                         }
  665.                     }
  666.  
  667.                     if(ThisTag = FindTagItem(GTLV_Selected,TagList))
  668.                     {
  669.                         Node->Current = (LONG)ThisTag->ti_Data;
  670.  
  671.                         if(Gadget)
  672.                         {
  673.                             Exclude = GTLV_Selected;
  674.  
  675.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  676.                                 GTLV_Selected,        Node->Current,
  677.                                 GTLV_Labels,        Node->Special.List.Labels,
  678.                             TAG_DONE);
  679.                         }
  680.  
  681.                         LTP_PutStorage(Node);
  682.  
  683.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  684.                             return;
  685.                     }
  686.  
  687.                     if(ThisTag = FindTagItem(LALV_Selected,TagList))
  688.                     {
  689.                         Node->Current = (LONG)ThisTag->ti_Data;
  690.  
  691.                         if(Gadget)
  692.                         {
  693.                             ULONG WhichTag;
  694.  
  695.                             if(V39)
  696.                                 WhichTag = GTLV_MakeVisible;
  697.                             else
  698.                                 WhichTag = GTLV_Top;
  699.  
  700.                             Exclude = LALV_Selected;
  701.  
  702.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  703.                                 GTLV_Selected,        Node->Current,
  704.                                 GTLV_Labels,        Node->Special.List.Labels,
  705.  
  706.                                 (Node->Current < 0) ? TAG_DONE : TAG_IGNORE,0,
  707.  
  708.                                 WhichTag,            Node->Current,
  709.                             TAG_DONE);
  710.                         }
  711.  
  712.                         LTP_PutStorage(Node);
  713.  
  714.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  715.                             return;
  716.                     }
  717.  
  718.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  719.                     {
  720.                         if(!V39)
  721.                         {
  722.                             if(!NewTags)
  723.                             {
  724.                                 if(!(NewTags = CloneTagItems(TagList)))
  725.                                     return;
  726.                             }
  727.  
  728.                             FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  729.                         }
  730.                     }
  731.  
  732.                     break;
  733.  
  734.                 case MX_KIND:
  735.  
  736.                     if(ThisTag = FindTagItem(GTMX_Active,TagList))
  737.                     {
  738.                         if(Node->Current == ThisTag->ti_Data)
  739.                             Exclude = GTMX_Active;
  740.                         else
  741.                         {
  742.                             Node->Current = ThisTag->ti_Data;
  743.  
  744.                             LTP_PutStorage(Node);
  745.  
  746.                             if(!LTP_NotifyPager(handle,Node->Special.Radio.AutoPageID,Node->Current))
  747.                                 return;
  748.                         }
  749.                     }
  750.  
  751.                     if(!V39)
  752.                     {
  753.                         if(FindTagItem(GA_Disabled,TagList))
  754.                         {
  755.                             if(!(NewTags = CloneTagItems(TagList)))
  756.                                 return;
  757.                             else
  758.                                 FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  759.                         }
  760.                     }
  761.  
  762.                     break;
  763.  
  764.                 case CYCLE_KIND:
  765.  
  766.                     if(ThisTag = FindTagItem(GTCY_Active,TagList))
  767.                     {
  768.                         if(Node->Current == ThisTag->ti_Data)
  769.                             Exclude = GTCY_Active;
  770.                         else
  771.                         {
  772.                             Node->Current = ThisTag->ti_Data;
  773.  
  774.                             LTP_PutStorage(Node);
  775.  
  776.                             if(!LTP_NotifyPager(handle,Node->Special.Cycle.AutoPageID,Node->Current))
  777.                                 return;
  778.                         }
  779.                     }
  780.  
  781.                     if(ThisTag = FindTagItem(GTCY_Labels,TagList))
  782.                     {
  783.                         STRPTR    *Strings;
  784.                         LONG     Count = 0;
  785.  
  786.                         if(Strings = (STRPTR *)ThisTag->ti_Data)
  787.                         {
  788.                             while(Strings[Count])
  789.                                 Count++;
  790.                         }
  791.  
  792.                         if(Count)
  793.                             Node->Max = Count - 1;
  794.                         else
  795.                             Node->Max = 0;
  796.                     }
  797.  
  798.                     break;
  799. #if defined(DO_POPUP_KIND) && defined(DO_BOOPSI_KIND)
  800.                 case POPUP_KIND:
  801.                 {
  802.                     BOOL NewCurrent = FALSE,NewLabels = FALSE;
  803.  
  804.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  805.                         Node->Disabled = ThisTag->ti_Data;
  806.  
  807.                     if(ThisTag = FindTagItem(LAPU_Labels,TagList))
  808.                     {
  809.                         STRPTR    *Strings;
  810.                         LONG     Count = 0;
  811.  
  812.                         if(Strings = (STRPTR *)ThisTag->ti_Data)
  813.                         {
  814.                             while(Strings[Count])
  815.                                 Count++;
  816.                         }
  817.  
  818.                         if(Count)
  819.                             Node->Max = Count - 1;
  820.                         else
  821.                             Node->Max = 0;
  822.  
  823.                         Node->Special.Popup.Choices = (STRPTR *)ThisTag->ti_Data;
  824.  
  825.                         DB(kprintf("max: %ld\n",Node->Max));
  826.  
  827.                         NewLabels = TRUE;
  828.                     }
  829.  
  830.                     if(ThisTag = FindTagItem(LAPU_Active,TagList))
  831.                     {
  832.                         DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  833.  
  834.                         if(Node->Current != ThisTag->ti_Data)
  835.                         {
  836.                             Node->Current = ThisTag->ti_Data;
  837.  
  838.                             LTP_PutStorage(Node);
  839.  
  840.                             if(!LTP_NotifyPager(handle,Node->Special.Popup.AutoPageID,Node->Current))
  841.                                 return;
  842.  
  843.                             NewCurrent = TRUE;
  844.                         }
  845.                     }
  846.  
  847.                     if(Node->Host)
  848.                     {
  849.                         SetGadgetAttrs(Node->Host,handle->Window,NULL,
  850.                             NewCurrent ? PIA_Active : TAG_IGNORE,    Node->Current,
  851.                             NewLabels ? PIA_Labels : TAG_IGNORE,    Node->Special.Popup.Choices,
  852.                         TAG_MORE,TagList);
  853.                     }
  854.  
  855.                     return;
  856.                 }
  857. #endif
  858.  
  859. #if defined(DO_TAB_KIND) && defined(DO_BOOPSI_KIND)
  860.                 case TAB_KIND:
  861.                 {
  862.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  863.                         Node->Disabled = ThisTag->ti_Data;
  864.  
  865.                     if(ThisTag = FindTagItem(LATB_Active,TagList))
  866.                     {
  867.                         DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  868.  
  869.                         if(Node->Current != ThisTag->ti_Data)
  870.                         {
  871.                             Node->Current = ThisTag->ti_Data;
  872.  
  873.                             LTP_PutStorage(Node);
  874.  
  875.                             if(!LTP_NotifyPager(handle,Node->Special.Tab.AutoPageID,Node->Current))
  876.                                 return;
  877.                             else
  878.                             {
  879.                                 if(Node->Host)
  880.                                 {
  881.                                     SetGadgetAttrs(Node->Host,handle->Window,NULL,
  882.                                         TIA_Index,Node->Current,
  883.                                     TAG_MORE,TagList);
  884.                                 }
  885.                             }
  886.                         }
  887.                     }
  888.  
  889.                     return;
  890.                 }
  891. #endif
  892.                 case PALETTE_KIND:
  893.  
  894.                     if(ThisTag = FindTagItem(GTPA_Color,TagList))
  895.                     {
  896.                         if(Node->Current == ThisTag->ti_Data)
  897.                             Exclude = GTPA_Color;
  898.                         else
  899.                         {
  900.                             Node->Current = ThisTag->ti_Data;
  901.  
  902.                             LTP_PutStorage(Node);
  903.  
  904.                             if(Node->Special.Palette.UsePicker)
  905.                             {
  906.                                 if(Gadget)
  907.                                     LTP_DrawPalette(handle,Node);
  908.  
  909.                                 return;
  910.                             }
  911.                         }
  912.                     }
  913.  
  914.                     break;
  915.  
  916.                 case INTEGER_KIND:
  917.  
  918.                     if(ThisTag = FindTagItem(GTIN_Number,TagList))
  919.                     {
  920.                         LONG num = ThisTag->ti_Data;
  921.  
  922.                         if(num < Node->Min)
  923.                             num = Node->Min;
  924.                         else
  925.                         {
  926.                             if(num > Node->Max)
  927.                                 num = Node->Max;
  928.                         }
  929.  
  930.                         if(Gadget)
  931.                         {
  932. #ifdef DO_HEXHOOK
  933.                             if(!Node->Special.Integer.EditHook || Node->Special.Integer.CustomHook)
  934.                             {
  935.                                 UBYTE                 buffer[20];
  936.                                 struct StringInfo    *stringInfo;
  937.  
  938.                                 SPrintf(buffer,"%ld",num);
  939.  
  940.                                 Exclude = GTIN_Number;
  941.  
  942.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  943.                                     GTST_String,    buffer,
  944.                                     GTIN_Number,    num,
  945.                                 TAG_DONE);
  946.  
  947.                                 stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  948.  
  949.                                 stringInfo->LongInt = num;
  950.                             }
  951.                             else
  952.                             {
  953.                                 UBYTE                 buffer[40];
  954.                                 struct StringInfo    *stringInfo;
  955.                                 STRPTR                 Index;
  956.                                 LONG                 Value,Number = num,
  957.                                                      Scale,Sign;
  958.  
  959.                                 stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  960.  
  961.                                 Index = stringInfo->Buffer;
  962.  
  963.                                 while(*Index && *Index == ' ')
  964.                                     Index++;
  965.  
  966.                                 switch(Index[0])
  967.                                 {
  968.                                     case '$':
  969.  
  970.                                         SPrintf(buffer,"$%lx",num);
  971.                                         break;
  972.  
  973.                                     case '&':
  974.  
  975.                                         if(Number < 0)
  976.                                         {
  977.                                             Sign = -1;
  978.                                             Number = -Number;
  979.                                         }
  980.                                         else
  981.                                             Sign = 1;
  982.  
  983.                                         for(Value = 0, Scale = 1 ; Number ; Number /= 8, Scale *= 10)
  984.                                             Value += (Number & 7) * Scale;
  985.  
  986.                                         SPrintf(buffer,"&%ld",(LONG)(Sign * Value));
  987.                                         break;
  988.  
  989.                                     case '%':
  990.  
  991.                                         if(Number < 0)
  992.                                         {
  993.                                             Sign = -1;
  994.                                             Number = -Number;
  995.                                         }
  996.                                         else
  997.                                             Sign = 1;
  998.  
  999.                                         for(Value = 0, Scale = 1 ; Number ; Number /= 2, Scale *= 10)
  1000.                                             Value += (Number & 1) * Scale;
  1001.  
  1002.                                         SPrintf(buffer,"%%%ld",(LONG)(Sign * Value));
  1003.                                         break;
  1004.  
  1005.                                     case '0':
  1006.  
  1007.                                         if(Index[1] == 'x')
  1008.                                         {
  1009.                                             SPrintf(buffer,"0x%lx",num);
  1010.                                             break;
  1011.                                         }
  1012.  
  1013.                                         // Fall through to...
  1014.  
  1015.                                     default:
  1016.  
  1017.                                         SPrintf(buffer,"%ld",num);
  1018.                                         break;
  1019.                                 }
  1020.  
  1021.                                 Exclude = GTIN_Number;
  1022.  
  1023.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1024.                                     GTST_String,buffer,
  1025.                                 TAG_DONE);
  1026.  
  1027.                                 stringInfo->LongInt = num;
  1028.                             }
  1029. #else
  1030.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1031.                                 GTIN_Number,num,
  1032.                             TAG_DONE);
  1033. #endif
  1034.                         }
  1035.  
  1036.                         Node->Special.Integer.Number = num;
  1037.  
  1038.                         LTP_PutStorage(Node);
  1039.                     }
  1040.  
  1041.                     break;
  1042.  
  1043.                 case NUMBER_KIND:
  1044.  
  1045.                     if(ThisTag = FindTagItem(GTNM_Number,TagList))
  1046.                         Node->Special.Number.Number = ThisTag->ti_Data;
  1047.  
  1048.                     break;
  1049.  
  1050.                 case SLIDER_KIND:
  1051.  
  1052.                     if(ThisTag = FindTagItem(GTSL_Level,TagList))
  1053.                     {
  1054.                         if(Node->Current == ThisTag->ti_Data)
  1055.                             Exclude = GTSL_Level;
  1056.                         else
  1057.                         {
  1058.                             Node->Current = ThisTag->ti_Data;
  1059.  
  1060.                             LTP_PutStorage(Node);
  1061.                         }
  1062.                     }
  1063.  
  1064.                     if(ThisTag = FindTagItem(GTSL_Min,TagList))
  1065.                     {
  1066.                         Node->Min = ThisTag->ti_Data;
  1067.  
  1068.                         if(Node->Current < Node->Min)
  1069.                         {
  1070.                             Node->Current = Node->Min;
  1071.  
  1072.                             LTP_PutStorage(Node);
  1073.                         }
  1074.                     }
  1075.  
  1076.                     if(ThisTag = FindTagItem(GTSL_Max,TagList))
  1077.                     {
  1078.                         Node->Max = ThisTag->ti_Data;
  1079.  
  1080.                         if(Node->Current > Node->Max)
  1081.                         {
  1082.                             Node->Current = Node->Max;
  1083.  
  1084.                             LTP_PutStorage(Node);
  1085.                         }
  1086.                     }
  1087.  
  1088.                     break;
  1089.  
  1090.                 case SCROLLER_KIND:
  1091.  
  1092.                     if(ThisTag = FindTagItem(GTSC_Top,TagList))
  1093.                     {
  1094.                         if(Node->Current == ThisTag->ti_Data)
  1095.                             Exclude = GTSC_Top;
  1096.                         else
  1097.                         {
  1098.                             Node->Current = ThisTag->ti_Data;
  1099.  
  1100.                             LTP_PutStorage(Node);
  1101.                         }
  1102.                     }
  1103.  
  1104.                     if(ThisTag = FindTagItem(GTSC_Total,TagList))
  1105.                     {
  1106.                         Node->Max = ThisTag->ti_Data;
  1107.  
  1108.                         if(Node->Current > Node->Max)
  1109.                         {
  1110.                             Node->Current = Node->Max;
  1111.  
  1112.                             LTP_PutStorage(Node);
  1113.                         }
  1114.                     }
  1115.  
  1116.                     if(ThisTag = FindTagItem(GTSC_Visible,TagList))
  1117.                         Node->Special.Scroller.Visible = ThisTag->ti_Data;
  1118.  
  1119.                     break;
  1120.  
  1121.                 case BOX_KIND:
  1122.                 {
  1123.                     BOOL Visible = Node->Special.Box.Parent->Special.Group.Visible;
  1124.  
  1125.                     if(ThisTag = FindTagItem(LABX_Text,TagList))
  1126.                     {
  1127.                         STRPTR    Text = (STRPTR)ThisTag->ti_Data;
  1128.                         LONG    Index;
  1129.  
  1130.                         Index = (LONG)GetTagData(LABX_Index,0,TagList);
  1131.  
  1132.                         if(Index >= 0 && Index < Node->Lines)
  1133.                         {
  1134.                             if(Node->Special.Box.ReserveSpace)
  1135.                             {
  1136.                                 LONG Len = strlen(Text);
  1137.  
  1138.                                 if(Len > Node->Special.Box.MaxSize)
  1139.                                     Len = Node->Special.Box.MaxSize;
  1140.  
  1141.                                 CopyMem(Text,Node->Special.Box.Lines[Index],Len);
  1142.  
  1143.                                 Node->Special.Box.Lines[Index][Len] = 0;
  1144.                             }
  1145.                             else
  1146.                                 Node->Special.Box.Lines[Index] = Text;
  1147.                         }
  1148.  
  1149.                         if(Visible)
  1150.                             LTP_PrintBoxLine(handle,Node,Index);
  1151.                     }
  1152.  
  1153.                     if(ThisTag = FindTagItem(LABX_Lines,TagList))
  1154.                     {
  1155.                         STRPTR    *Lines = (STRPTR *)ThisTag->ti_Data;
  1156.                         LONG     i;
  1157.  
  1158.                         if(Node->Special.Box.ReserveSpace)
  1159.                         {
  1160.                             LONG Len;
  1161.  
  1162.                             for(i = 0 ; i < Node->Lines ; i++)
  1163.                             {
  1164.                                 if(Lines[i])
  1165.                                 {
  1166.                                     Len = strlen(Lines[i]);
  1167.  
  1168.                                     if(Len > Node->Special.Box.MaxSize)
  1169.                                         Len = Node->Special.Box.MaxSize;
  1170.  
  1171.                                     CopyMem(Lines[i],Node->Special.Box.Lines[i],Len);
  1172.  
  1173.                                     Node->Special.Box.Lines[i][Len] = 0;
  1174.  
  1175.                                     if(Visible)
  1176.                                         LTP_PrintBoxLine(handle,Node,i);
  1177.                                 }
  1178.                                 else
  1179.                                     break;
  1180.                             }
  1181.                         }
  1182.                         else
  1183.                         {
  1184.                             for(i = 0 ; i < Node->Lines ; i++)
  1185.                             {
  1186.                                 if(Lines[i])
  1187.                                 {
  1188.                                     Node->Special.Box.Lines[i] = Lines[i];
  1189.  
  1190.                                     if(Visible)
  1191.                                         LTP_PrintBoxLine(handle,Node,i);
  1192.                                 }
  1193.                                 else
  1194.                                     break;
  1195.                             }
  1196.                         }
  1197.                     }
  1198.  
  1199.                     break;
  1200.                 }
  1201.  
  1202.                 case TEXT_KIND:
  1203.  
  1204.                     if(ThisTag = FindTagItem(GTTX_Text,TagList))
  1205.                     {
  1206.                         STRPTR text = (STRPTR)ThisTag->ti_Data;
  1207.  
  1208.                         if(!text)
  1209.                             text = "";
  1210.  
  1211.                         if(Node->Special.Text.CopyText)
  1212.                         {
  1213.                             LONG len;
  1214.  
  1215.                             if(Node->Special.Text.Text)
  1216.                                 len = strlen(Node->Special.Text.Text) + 1;
  1217.                             else
  1218.                                 len = 0;
  1219.  
  1220.                             if(len)
  1221.                                 LTP_Free(handle,Node->Special.Text.Text,len);
  1222.  
  1223.                             len = strlen(text);
  1224.  
  1225.                             if(Node->Special.Text.Text = LTP_Alloc(handle,len + 1))
  1226.                                 strcpy(Node->Special.Text.Text,text);
  1227.                         }
  1228.                         else
  1229.                             Node->Special.Text.Text = text;
  1230.                     }
  1231.  
  1232.                     if(ThisTag = FindTagItem(GTTX_FrontPen,TagList))
  1233.                         Node->Special.Text.FrontPen = (WORD)ThisTag->ti_Data;
  1234.  
  1235.                     if(ThisTag = FindTagItem(GTTX_BackPen,TagList))
  1236.                         Node->Special.Text.BackPen = (WORD)ThisTag->ti_Data;
  1237.  
  1238.                     break;
  1239.  
  1240.                 case GROUP_KIND:
  1241.  
  1242.                     if(Node->Special.Group.Paging)
  1243.                     {
  1244.                         if(ThisTag = FindTagItem(LAGR_ActivePage,TagList))
  1245.                         {
  1246.                             ObjectNode *node;
  1247.  
  1248.                             node = Node;
  1249.  
  1250.                             if(node->Type == GROUP_KIND)
  1251.                             {
  1252.                                 if(node->Special.Group.ActivePage != ThisTag->ti_Data)
  1253.                                 {
  1254.                                     LONG    Left    = node->Left,
  1255.                                             Top        = node->Top,
  1256.                                             Width    = node->Width,
  1257.                                             Height    = node->Height;
  1258.  
  1259.                                     if(node->Label || node->Special.Group.Frame || node->Special.Group.FrameType == FRAMETYPE_Label)
  1260.                                     {
  1261.                                         Left    += 4 + handle->GlyphWidth;
  1262.                                         Width    -= 2 * (4 + handle->GlyphWidth);
  1263.  
  1264.                                         if(node->Label)
  1265.                                         {
  1266.                                             Top        += handle->GlyphHeight;
  1267.                                             Height    -= handle->GlyphHeight + 3;
  1268.                                         }
  1269.                                         else
  1270.                                         {
  1271.                                             Top        += 2;
  1272.                                             Height    -= 5;
  1273.                                         }
  1274.                                     }
  1275.                                     else
  1276.                                     {
  1277.                                         if(node->Special.Group.FrameType == FRAMETYPE_Tab)
  1278.                                         {
  1279.                                             Width    -= 2 * 2;
  1280.                                             Left    += 2;
  1281.                                             Height    -= 1;
  1282.                                         }
  1283.                                     }
  1284.  
  1285.                                     node->Special.Group.ActivePage = ThisTag->ti_Data;
  1286.  
  1287.                                     LT_LockWindow(handle->Window);
  1288.  
  1289.                                     LTP_EraseBox(&handle->RPort,Left,Top,Width,Height);
  1290.  
  1291.                                     LT_RebuildTagList(handle,FALSE,NULL);
  1292.  
  1293.                                     LT_UnlockWindow(handle->Window);
  1294.                                 }
  1295.                             }
  1296.                         }
  1297.                     }
  1298.  
  1299.                     break;
  1300.             }
  1301.  
  1302.             if(ThisTag = FindTagItem(LA_LabelText,TagList))
  1303.                 Node->Label = (STRPTR)ThisTag->ti_Data;
  1304.  
  1305.             if(ThisTag = FindTagItem(LA_LabelID,TagList))
  1306.             {
  1307.                 if(handle->LocaleHook)
  1308.                     Node->Label = (STRPTR)CallHookPkt(handle->LocaleHook,handle,(APTR)ThisTag->ti_Data);
  1309.             }
  1310.  
  1311.             if(ThisTag = FindTagItem(GA_Disabled,TagList))
  1312.             {
  1313.                 if((Node->Disabled && ThisTag->ti_Data) || (!Node->Disabled && !ThisTag->ti_Data))
  1314.                 {
  1315.                     if(!NewTags)
  1316.                         NewTags = CloneTagItems(TagList);
  1317.  
  1318.                     if(NewTags)
  1319.                         FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  1320.                 }
  1321.                 else
  1322.                 {
  1323.                     Node->Disabled = ThisTag->ti_Data;
  1324.  
  1325.                     if(Gadget)
  1326.                     {
  1327.                         struct Gadget *gad;
  1328.  
  1329.                         switch(Node->Type)
  1330.                         {
  1331. #ifdef DO_LEVEL_KIND
  1332.                             case LEVEL_KIND:
  1333.  
  1334.                                 gad = Gadget;
  1335.                                 break;
  1336. #endif    /* DO_LEVEL_KIND */
  1337.  
  1338.                             case TEXT_KIND:
  1339.  
  1340.                                 gad = Node->Special.Text.Picker;
  1341.                                 break;
  1342.  
  1343.                             case STRING_KIND:
  1344.  
  1345.                                 gad = Node->Special.String.Picker;
  1346.                                 break;
  1347.  
  1348.                             case INTEGER_KIND:
  1349.  
  1350.                                 LTP_FixState(handle,Node->Disabled,Node->Special.Integer.LeftIncrementer,GFLG_DISABLED);
  1351.  
  1352.                                 gad = Node->Special.Integer.RightIncrementer;
  1353.                                 break;
  1354.  
  1355.                             case TAPEDECK_KIND:
  1356.  
  1357.                                 gad = Node->Host;
  1358.  
  1359.                                 Gadget = NULL;
  1360.  
  1361.                                 break;
  1362.  
  1363.                             case PALETTE_KIND:
  1364.  
  1365.                                 gad = Node->Special.Palette.Picker;
  1366.                                 break;
  1367.  
  1368.                             case BUTTON_KIND:
  1369.  
  1370.                                 if(Node->Special.Button.ButtonImage)
  1371.                                 {
  1372.                                     gad = Node->Host;
  1373.  
  1374.                                     Gadget = NULL;
  1375.  
  1376.                                     break;
  1377.                                 }
  1378.  
  1379.                                 // FALLS THROUGH TO
  1380.  
  1381.                             default:
  1382.  
  1383.                                 gad = NULL;
  1384.                                 break;
  1385.                         }
  1386.  
  1387.                         LTP_FixState(handle,Node->Disabled,gad,GFLG_DISABLED);
  1388.                     }
  1389.                 }
  1390.             }
  1391.  
  1392.             if(Exclude)
  1393.             {
  1394.                 ULONG Filter[2];
  1395.  
  1396.                 Filter[0] = Exclude;
  1397.                 Filter[1] = TAG_DONE;
  1398.  
  1399.                 if(!NewTags)
  1400.                     NewTags = CloneTagItems(TagList);
  1401.  
  1402.                 if(NewTags)
  1403.                     FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  1404.             }
  1405.  
  1406.             if(Gadget)
  1407.             {
  1408.                 struct TagItem *tags = TagList;
  1409.  
  1410.                 if(NewTags)
  1411.                     tags = NewTags;
  1412.  
  1413.                 if(!V39 && Node->Disabled && Node->Type == SLIDER_KIND)
  1414.                 {
  1415.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1416.                         GA_Disabled,    FALSE,
  1417.                     TAG_MORE,tags);
  1418.  
  1419.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1420.                         GA_Disabled,    TRUE,
  1421.                     TAG_DONE);
  1422.                 }
  1423.                 else
  1424.                     GT_SetGadgetAttrsA(Gadget,handle->Window,NULL,tags);
  1425.             }
  1426.  
  1427.             if(LIKE_STRING_KIND(Node))
  1428.                 LTP_PutStorage(Node);
  1429.  
  1430.             FreeTagItems(NewTags);
  1431.         }
  1432.     }
  1433. }
  1434.